package com.content.view.Frame.Content
{
	import com.content.model.LoadedAssets.SkinProxy;
	import com.library.core.IDisposable;
	import com.library.core.UIObject;
	
	import flash.display.BitmapData;
	import flash.display.Shape;
	import flash.display.Sprite;
	
	import gs.TweenLite;
	
	public class Content extends UIObject implements IDisposable
	{
		public static const NAME:String							= 'ContentView';
		
		public static const SHOW:String							= NAME + "-" + 'Show';
		public static const HIDE:String							= NAME + "-" + 'Hide';
//		public static const INIT:String							= NAME + "-" + 'Init';
//		public static const SWITCH_PANEL:String					= NAME + '-' + 'Switch_Panel';
		
		private var _bg:Shape;
		private var _bgBmpData:BitmapData;
		
		public function Content()
		{
			Init();
		}
		
		private function Init():void
		{
			this.alpha = 0;
			this.visible = false;
			
			_bg = new Shape();
			addChild(_bg);
			
			var bg:Sprite = new SkinProxy.IMG_BG_Framework() as Sprite;
			_bgBmpData = new BitmapData(bg.width, bg.height, false);
			_bgBmpData.draw(bg);
		}
		
		public function SetLayout(sWidth:int, sHeight:int):void{
			_bg.graphics.clear();
			_bg.graphics.beginBitmapFill(_bgBmpData, null, true);
			_bg.graphics.drawRect(0,0,sWidth, sHeight);
		}
		
		/* Event Handler
		 * ------------------------------------------------------------- */
	
		/* Public Method
		 * ------------------------------------------------------------- */
		public function Show(delay:Number = 0, duration:Number = 1.0):void{
			TweenLite.to( this, duration, { autoAlpha: 1, delay: delay } );
		}		
		public function Hide():void	{
			TweenLite.to( this, .5, { autoAlpha: 0 } );
		}
		
		public function Dispose():void
		{
			_bgBmpData.dispose();
			_bgBmpData = null;
		}
	}
}